package com.school.sys.module.service;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.school.sys.module.dao.ModuleDAO;
import com.school.sys.module.entity.Module;
import com.school.util.Parameter;
import com.school.util.UI;
@Service
public class ModuleServiceImpl implements ModuleService{
	@Resource
	private ModuleDAO mdao;
	
	@Override
	public Map<String, Object> getModuleAll(Module module, Parameter p) {
		List<Module> list = mdao.getModuleAll(p);
		int row = mdao.getRows(Module.class, "");
		return UI.getCommon().getGridMap(list, row);
	}

	@Override
	public boolean persistModule(Module module) {
		boolean bo =false;
		try {
			mdao.persist(module);
			bo=true;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return bo;
	}

	@Override
	public boolean delModule(Module module) {
		boolean bo =false;
		try {
			mdao.remove(module);
			bo=true;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return bo;
	}
}
